package com.ftg.learn.day09;

import java.util.HashMap;

/**
 * 英汉
 *
 * @author 布衣
 */
public class EnCnDic extends MyDic implements DicNet{

    @Override
    public String find(String en) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < super.list.size(); i++) {
            if (en.equals(super.list.get(i).getEn())) {
                return sb.append("查询的目标为:")
                        .append(en)
                        .append("返回:\n")
                        .append("对应的汉字为:")
                        .append(super.list.get(i).getCn())
                        .toString();
            }
        }
        return "无查询结果";
    }

    @Override
    public void addReport(String cn, String en, String desc) {
        WordReport wr = new WordReport();
        wr.setCn(cn);
        wr.setEn(en);
        wr.setDesc(desc);
        super.list.add(wr);

        HashMap<String,String> map = new HashMap<>(5);
        map.put("name","布衣");

    }
}
